{# The open transactions (db_transactions), read like Logs: on Postgres every connection, with what it waits on and whom it blocks, ended one by one; on SQLite each one held a while (db_activity.SHOWN_AFTER), with where its code is now, ended by restarting its container. Fixed columns keep each name on one line; the statement (or the code) is cut at the edge, a click opens it (kept open as the table re-sends itself, ``data-row``), and its copy takes it whole. Red past the slow threshold. #} {% from "components/macros/form.html" import action %} {% from "components/macros/layout.html" import badge %} {% from "pages/overseer/_macros.html" import opens_rows, row_cell, rows_head %} {% from "pages/overseer/database/_macros.html" import copy_cell %} {% set cell = row_cell("whitespace-nowrap truncate") %} {# How the transaction stands, either engine: its state, how long open. #} {% macro held(row) %} {{ row.state }} {{ badge(row.open_for.label, row.open_for.tone) }} {%- endmacro %}

{{ transactions_summary }} ยท {% if transactions_postgres %}Every connection to this database, the longest open transaction first. Red past {{ threshold }} s. End rolls its transaction back and closes it.{% else %}SQLite has one writer: a transaction held here makes every other process wait. Each one held past {{ shown_after|round|int }} s, with the code holding it, red past {{ threshold }} s. SQLite cannot end another process's transaction, so Restart restarts the container holding it.{% endif %}

{% if transactions %} {% if transactions_postgres %} {{ rows_head(["PID", "Process", "State", "Open for", "Waiting on", "Blocked by", "Query"], actions=True) }} {% else %} {{ rows_head(["Process", "Container", "Code", "State", "Open for"], actions=True) }} {% endif %} {% for row in transactions %} {% if transactions_postgres %}{{ copy_cell(row.pid, "pid") }}{% endif %} {{ copy_cell(row.process, "process") }} {% if transactions_postgres %} {{ held(row) }} {% set blocked = row.blocked_by|join(", ") if row.blocked_by else "-" %} {{ copy_cell(row.query, "query", lang="sql") }} {% else %} {{ copy_cell(row.container, "container") }} {{ copy_cell(row.code, "code", opens=True) }} {{ held(row) }} {% endif %} {% endfor %}
{{ row.wait or "-" }}{{ blocked }}{% if row.end_url %}{{ action("End" if row.pid else "Restart", hx_dialog(row.end_url, "data-write"), "warn") }}{% endif %}
{% else %}

Nothing held right now

{% endif %}